package com.turing.post.salesmanage.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @销售单
 * @author zxl
 * @date 2012-12-17
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "SALEORDER")
public class SaleOrder implements Serializable {

	/**
	 * @购卡人类型0 – 个人
	 */
	public static final String SaleOrder_BuyerType_Person = "0";

	/**
	 * @购卡人类型1 – 单位
	 */
	public static final String SaleOrder_BuyerType_company = "1";

	/**
	 * 销售单状态 录入
	 */
	public static final String SALEORDER_ORDERSTATUS_INPUT = "0";
	/**
	 * 销售单状态 已出库
	 */
	public static final String SALEORDER_ORDERSTATUS_LIBRARY = "3";

	/**
	 * 打包上送销售单
	 */
	public static final String SaleOrder_OrderStatus_Sent = "5";

	/**
	 * 审核资金
	 */
	public static final String SaleOrder_OrderStatus_AuthMoney = "6";

	/**
	 * 审核卡
	 */
	public static final String SaleOrder_OrderStatus_AuthCard = "7";

	/**
	 * 销售单状态 已激活
	 */
	public static final String SALEORDER_ORDERSTATUS_ACTIVATED = "4";

	/**
	 * 销售单状态 冻结
	 */
	public static final String SALEORDER_ORDERSTATUS_FREEZE = "D";
	/**
	 * 销售单状态 解除冻结
	 */
	public static final String SALEORDER_ORDERSTATUS_UNDOFREEZE = "J";
	/**
	 * 销售单状态 取消
	 */
	public static final String SALEORDER_ORDERSTATUS_CANCEL = "C";

	/**
	 * 正常售卡
	 */
	public static final String SaleOrder_PaidType_Normal = "0";
	/**
	 * 授信购卡
	 */
	public static final String SaleOrder_PaidType_Credit = "1";

	/**
	 * 销售单查询返回按钮状态 录入
	 */
	public static final String BtnStatus_Input = "Input";
	/**
	 * 销售单查询返回按钮状态 修改
	 */
	public static final String BtnStatus_Edit = "Edit";
	/**
	 * 销售单查询返回按钮状态 取消
	 */
	public static final String BtnStatus_Cancel = "Cancel";
	/**
	 * 销售单查询返回按钮状态 销售单卡绑定
	 */
	public static final String BtnStatus_SaleCard = "SaleCard";
	/**
	 * 销售单查询返回按钮状态 销售单持卡人实名绑定
	 */
	public static final String BtnStatus_RealName = "RealName";
	/**
	 * 销售单查询返回按钮状态 销售单销售员绑定
	 */
	public static final String BtnStatus_Sales = "Sales";
	/**
	 * 销售单查询返回按钮状态 录入确认
	 */
	public static final String BtnStatus_InputConfirm = "InputConfirm";
	/**
	 * 销售单查询返回按钮状态 录入确认撤销
	 */
	public static final String BtnStatus_InputConfirmCancel = "InputConfirmCancel";
	/**
	 * 销售单查询返回按钮状态 销售单付款
	 */
	public static final String BtnStatus_Paid = "Paid";
	/**
	 * 销售单查询返回按钮状态 付清
	 */
	public static final String BtnStatus_PaidOff = "PaidOff";
	/**
	 * 销售单查询返回按钮状态 付清撤销
	 */
	public static final String BtnStatus_PaidOffCancel = "PaidOffCancel";
	/**
	 * 销售单查询返回按钮状态 出库
	 */
	public static final String BtnStatus_OutStock = "OutStock";
	/**
	 * 销售单查询返回按钮状态 出库撤销
	 */
	public static final String BtnStatus_OutStockCancel = "OutStockCancel";
	/**
	 * 销售单查询返回按钮状态 批量激活
	 */
	public static final String BtnStatus_Activate = "Activate";
	/**
	 * 销售单查询返回按钮状态 冻结
	 */
	public static final String BtnStatus_Freeze = "Freeze";
	/**
	 * 销售单查询返回按钮状态 解冻
	 */
	public static final String BtnStatus_FreezeCancel = "FreezeCancel";
	/**
	 * 销售单查询返回按钮状态 激活单查询销售单激活按钮显示
	 */
	public static final String BtnStatus_ActivateConfirm = "ActivateConfirm";
	/**
	 * 销售单查询返回按钮状态 激活单查询销售单激活按钮不显示
	 */
	public static final String BtnStatus_ActivateConfirmHidden = "ActivateConfirmHidden";
	/**
	 * 销售单查询返回按钮状态 撤销激活按钮显示
	 */
	public static final String BtnStatus_ActivateCancelOrder = "ActivateCancelOrder";
	/**
	 * 销售单查询返回按钮状态 撤销激活按钮不显示
	 */
	public static final String BtnStatus_ActivateCancelOrderHidden = "ActivateCancelOrderHidden";
	/**
	 * 销售单ID
	 */
	private BigInteger saleOrderId;

	/**
	 * 销售业务单号
	 */
	private String saleOrderSeqNo;
	/**
	 * 销售机构NO
	 */
	private String saleBranchNo;
	/**
	 * 销售确认时间
	 */
	private Date saleTime;
	/**
	 * 购卡人类型
	 */
	private String buyerType;
	/**
	 * 个人信息ID
	 */
	private BigInteger personalBuyerId;
	/**
	 * 单位信息ID
	 */
	private BigInteger organizeBuyerId;
	/**
	 * 代理人信息ID
	 */
	private BigInteger proxyBuyerId;
	/**
	 * 总售卡金额
	 */
	private BigInteger totalSaleAmount;
	/**
	 * 总付款金额
	 */
	private BigInteger alreayPaidAmount;
	/**
	 * 总售卡张数
	 */
	private Integer totalCardCount;
	/**
	 * 销售单状态
	 */
	private String orderStatus;

	/**
	 * 付款方式
	 */
	private String paidType;
	/**
	 * 上次激活MAC
	 */
	private String lastActiveMac;
	/**
	 * 上次激活帐户子系统记帐流水号
	 */
	private String lastActiveAccSeqNo;
	/**
	 * 上次激活撤销帐户子系统记帐流水号
	 */
	private String lastCancelActiveAccSeqNo;
	/**
	 * 操作员ID
	 */
	private BigInteger operId;
	/**
	 * 终审人员ID
	 */
	private Integer authOperId;
	/**
	 * 柜员店长审核员ID 参考发卡商OrderAmountLimit限制输入
	 */
	private BigInteger autherOperId;

	/**
	 * 激活机构号
	 */
	private String activateBranchNo;

	/**
	 * 提交凭证号 销售单提交上送时填写银行凭证号
	 */
	private BigInteger bankAccDetailId;
	/**
	 * 累计已核实资金
	 */
	private BigInteger totalCheckAmount;

	/**
	 * 实名制文件
	 */
	private BigInteger realNameFileId;
	/**
	 * 实名制文件
	 */
	private byte[] realNameFile;
	/**
	 * 确认风险备注
	 */
	private String riskRemark;

	private String openBranchNo;// 利益归属机构，其他机构也可选
	private Date tranDate;// 账务日期 Date Not Null
	private BigInteger fee;// 手续费 Number Not Null 默认0
	private BigInteger factFee;// 实际手续费 Number Not Null 默认0
	private BigInteger feeAuthOperId;// 实际手续费授权人 Int Null
	private BigInteger voucherId;// (UNI,FK) 凭证种类ID int Not Null
	private String voucherNo;// (UNI) 凭证号 Varchar（40） Not Null

	private BigInteger depositFee;// 押金

	private Date cancelDate;
	private Date cancelTime;
	private BigInteger cancelOperId;
	private BigInteger cancelAuthOperId;

	/**
	 * 上次激活帐务日期
	 */
	private Date lastActiveDate;
	
	/**
	 * 上次取消激活帐务日期
	 */
	private Date lastCancelActiveDate;
	
	/**
	 * 备注
	 */
	private String remark;
	/**
	 * 当前查询需要返回的按钮判断、不和数据库对应Transient
	 */
	private String btnStatus;

	public SaleOrder() {
		super();
	}

	@Id
	@Column(name = "SALEORDERID")
	public BigInteger getSaleOrderId() {
		return saleOrderId;
	}

	public void setSaleOrderId(BigInteger saleOrderId) {
		this.saleOrderId = saleOrderId;
	}

	@Column(name = "SALEORDERSEQNO")
	public String getSaleOrderSeqNo() {
		return saleOrderSeqNo;
	}

	public void setSaleOrderSeqNo(String saleOrderSeqNo) {
		this.saleOrderSeqNo = saleOrderSeqNo;
	}

	@Column(name = "SALEBRANCHNO")
	public String getSaleBranchNo() {
		return saleBranchNo;
	}

	public void setSaleBranchNo(String saleBranchNo) {
		this.saleBranchNo = saleBranchNo;
	}

	@Column(name = "SALETIME")
	public Date getSaleTime() {
		return saleTime;
	}

	public void setSaleTime(Date saleTime) {
		this.saleTime = saleTime;
	}

	@Column(name = "BUYERTYPE")
	public String getBuyerType() {
		return buyerType;
	}

	public void setBuyerType(String buyerType) {
		this.buyerType = buyerType;
	}

	@Column(name = "PERSONALBUYERID")
	public BigInteger getPersonalBuyerId() {
		return personalBuyerId;
	}

	public void setPersonalBuyerId(BigInteger personalBuyerId) {
		this.personalBuyerId = personalBuyerId;
	}

	@Column(name = "ORGANIZEBUYERID")
	public BigInteger getOrganizeBuyerId() {
		return organizeBuyerId;
	}

	public void setOrganizeBuyerId(BigInteger organizeBuyerId) {
		this.organizeBuyerId = organizeBuyerId;
	}

	@Column(name = "PROXYBUYERID")
	public BigInteger getProxyBuyerId() {
		return proxyBuyerId;
	}

	public void setProxyBuyerId(BigInteger proxyBuyerId) {
		this.proxyBuyerId = proxyBuyerId;
	}

	@Column(name = "TOTALSALEAMOUNT")
	public BigInteger getTotalSaleAmount() {
		return totalSaleAmount;
	}

	public void setTotalSaleAmount(BigInteger totalSaleAmount) {
		this.totalSaleAmount = totalSaleAmount;
	}

	@Column(name = "ALREAYPAIDAMOUNT")
	public BigInteger getAlreayPaidAmount() {
		return alreayPaidAmount;
	}

	public void setAlreayPaidAmount(BigInteger alreayPaidAmount) {
		this.alreayPaidAmount = alreayPaidAmount;
	}

	@Column(name = "TOTALCARDCOUNT")
	public Integer getTotalCardCount() {
		return totalCardCount;
	}

	public void setTotalCardCount(Integer totalCardCount) {
		this.totalCardCount = totalCardCount;
	}

	@Column(name = "ORDERSTATUS")
	public String getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(String orderStatus) {
		this.orderStatus = orderStatus;
	}

	@Column(name = "paidType")
	public String getPaidType() {
		return paidType;
	}

	public void setPaidType(String paidType) {
		this.paidType = paidType;
	}

	@Column(name = "LASTACTIVEMAC")
	public String getLastActiveMac() {
		return lastActiveMac;
	}

	public void setLastActiveMac(String lastActiveMac) {
		this.lastActiveMac = lastActiveMac;
	}

	@Column(name = "LASTACTIVEACCSEQNO")
	public String getLastActiveAccSeqNo() {
		return lastActiveAccSeqNo;
	}

	public void setLastActiveAccSeqNo(String lastActiveAccSeqNo) {
		this.lastActiveAccSeqNo = lastActiveAccSeqNo;
	}

	@Column(name = "LASTCANCELACTIVEACCSEQNO")
	public String getLastCancelActiveAccSeqNo() {
		return lastCancelActiveAccSeqNo;
	}

	public void setLastCancelActiveAccSeqNo(String lastCancelActiveAccSeqNo) {
		this.lastCancelActiveAccSeqNo = lastCancelActiveAccSeqNo;
	}

	@Column(name = "OPERID")
	public BigInteger getOperId() {
		return operId;
	}

	public void setOperId(BigInteger operId) {
		this.operId = operId;
	}

	@Column(name = "AUTHOPERID")
	public Integer getAuthOperId() {
		return authOperId;
	}

	public void setAuthOperId(Integer authOperId) {
		this.authOperId = authOperId;
	}

	@Column(name = "AUTHEROPERID")
	public BigInteger getAutherOperId() {
		return autherOperId;
	}

	public void setAutherOperId(BigInteger autherOperId) {
		this.autherOperId = autherOperId;
	}

	@Column(name = "activateBranchNo")
	public String getActivateBranchNo() {
		return activateBranchNo;
	}

	public void setActivateBranchNo(String activateBranchNo) {
		this.activateBranchNo = activateBranchNo;
	}

	@Column(name = "bankAccDetailId")
	public BigInteger getBankAccDetailId() {
		return bankAccDetailId;
	}

	public void setBankAccDetailId(BigInteger bankAccDetailId) {
		this.bankAccDetailId = bankAccDetailId;
	}

	@Column(name = "totalCheckAmount")
	public BigInteger getTotalCheckAmount() {
		return totalCheckAmount;
	}

	public void setTotalCheckAmount(BigInteger totalCheckAmount) {
		this.totalCheckAmount = totalCheckAmount;
	}

	@Column(name = "REALNAMEFILEID")
	public BigInteger getRealNameFileId() {
		return realNameFileId;
	}

	public void setRealNameFileId(BigInteger realNameFileId) {
		this.realNameFileId = realNameFileId;
	}

	@Transient
	public byte[] getRealNameFile() {
		return realNameFile;
	}

	public void setRealNameFile(byte[] realNameFile) {
		this.realNameFile = realNameFile;
	}

	@Column(name = "RISKREMARK")
	public String getRiskRemark() {
		return riskRemark;
	}

	public void setRiskRemark(String riskRemark) {
		this.riskRemark = riskRemark;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "openBranchNo")
	public String getOpenBranchNo() {
		return openBranchNo;
	}

	public void setOpenBranchNo(String openBranchNo) {
		this.openBranchNo = openBranchNo;
	}

	@Column(name = "tranDate")
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	@Column(name = "fee")
	public BigInteger getFee() {
		return fee;
	}

	public void setFee(BigInteger fee) {
		this.fee = fee;
	}

	@Column(name = "factFee")
	public BigInteger getFactFee() {
		return factFee;
	}

	public void setFactFee(BigInteger factFee) {
		this.factFee = factFee;
	}

	@Column(name = "feeAuthOperId")
	public BigInteger getFeeAuthOperId() {
		return feeAuthOperId;
	}

	public void setFeeAuthOperId(BigInteger feeAuthOperId) {
		this.feeAuthOperId = feeAuthOperId;
	}

	@Column(name = "voucherId")
	public BigInteger getVoucherId() {
		return voucherId;
	}

	public void setVoucherId(BigInteger voucherId) {
		this.voucherId = voucherId;
	}

	@Column(name = "voucherNo")
	public String getVoucherNo() {
		return voucherNo;
	}

	public void setVoucherNo(String voucherNo) {
		this.voucherNo = voucherNo;
	}

	@Column(name = "depositFee")
	public BigInteger getDepositFee() {
		return depositFee;
	}

	public void setDepositFee(BigInteger depositFee) {
		this.depositFee = depositFee;
	}

	@Column(name = "cancelDate")
	public Date getCancelDate() {
		return cancelDate;
	}

	public void setCancelDate(Date cancelDate) {
		this.cancelDate = cancelDate;
	}

	@Column(name = "cancelTime")
	public Date getCancelTime() {
		return cancelTime;
	}

	public void setCancelTime(Date cancelTime) {
		this.cancelTime = cancelTime;
	}

	@Column(name = "cancelOperId")
	public BigInteger getCancelOperId() {
		return cancelOperId;
	}

	public void setCancelOperId(BigInteger cancelOperId) {
		this.cancelOperId = cancelOperId;
	}

	@Column(name = "cancelAuthOperId")
	public BigInteger getCancelAuthOperId() {
		return cancelAuthOperId;
	}

	public void setCancelAuthOperId(BigInteger cancelAuthOperId) {
		this.cancelAuthOperId = cancelAuthOperId;
	}

	/**
	 * 查询列表按钮返回状态
	 * 
	 * @return
	 */
	@Transient
	public String getBtnStatus() {
		return btnStatus;
	}

	public void setBtnStatus(String btnStatus) {
		this.btnStatus = btnStatus;
	}

	public void setLastCancelActiveDate(Date lastCancelActiveDate) {
		this.lastCancelActiveDate = lastCancelActiveDate;
	}

	public Date getLastCancelActiveDate() {
		return lastCancelActiveDate;
	}

	public void setLastActiveDate(Date lastActiveDate) {
		this.lastActiveDate = lastActiveDate;
	}

	public Date getLastActiveDate() {
		return lastActiveDate;
	}
}